package tencent

//考察字符串
//numRows行，从上到下，然后从下到上循环 将s的字符依次填充每一行
func convert(s string, numRows int) string {
	if numRows == 1 {
		return s
	}
	strs := make([]string, numRows)
	idx, sign := 0, 1
	for _, cs := range s {
		//numRows == 1的是否会溢出
		if idx == 0 {
			sign = 1
		} else if idx == numRows-1 {
			sign = -1
		}
		strs[idx] = strs[idx] + string(cs)
		idx = idx + sign
	}
	result := ""
	for _, ss := range strs {
		result = result + ss
	}
	return result
}
